<template>
	<div>
		<div class="tl-form-line-title" id="aaa">
			产品小类
			<div class="simple-pager">
				<i class="el-icon-caret-left" :class="pageInfo.currentPage > 1 ? 'on' : ''" @click="prePage"></i>
				<i class="el-icon-caret-right" :class="pageInfo.currentPage < totalPage ? 'on' : ''" @click="nextPage"></i>
				当前：{{ pageInfo.currentPage }}/{{ totalPage }}，共{{ pageInfo.totalCount }}条
			</div>
			<div class="toolbar">
				<el-button type="text" size="medium" icon="el-icon-document-add" @click="openAddDialog('editForm')" v-if="!disableEditSubmit">新增</el-button>
			</div>
		</div>
		<!--表格渲染-->
		<el-table class="tl-table" ref="mainTable"  resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
			<el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
			<el-table-column prop="dispcatalog3" label="产品小类" min-width="150px" sortable="custom" sort-by="catalog3" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
			<el-table-column v-if="floorPricePermission" prop="floorprice" label="红线价格（元）" width="150px" sortable="custom" sort-by="floorprice" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
			<el-table-column prop="disppublishstate" label="是否发布" width="75px" sortable="custom" sort-by="publishstate" align="center" header-align="center" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					<el-tag v-if="scope.row.publishstate === '1'" type="success">是</el-tag>
					<el-tag v-else type="danger">否</el-tag>
				</template>
			</el-table-column>
			<el-table-column prop="enabled" label="启用" width="55px" sortable="custom" sort-by="enabled" align="center" header-align="center">
				<template slot-scope="scope">
					<el-tag v-if="scope.row.enabled === 1" type="success">是</el-tag>
					<el-tag v-else type="danger">否</el-tag>
				</template>
			</el-table-column>
			<el-table-column label="操作" width="80px" v-slot="scope" fixed="right">
				<el-dropdown trigger="hover">
					<el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
					<el-dropdown-menu>
						<el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)">查看</el-dropdown-item>
						<el-dropdown-item icon="el-icon-edit" @click.native="openEditDialog('editForm', scope.row.id)" v-if="!disableEditSubmit">编辑</el-dropdown-item>
						<el-dropdown-item icon="el-icon-delete" @click.native="doDelete(scope.row.id)" v-if="!disableEditSubmit && scope.row.publishstate && scope.row.publishstate === '0'">删除</el-dropdown-item>
					</el-dropdown-menu>
				</el-dropdown>
			</el-table-column>
		</el-table>
		<tl-edit ref="editForm" @refresh="doRefresh" :productInfo="productInfo" :floorPricePermission="floorPricePermission"></tl-edit>
	</div>
</template>

<script>
/** mixins */
import { mixin_edit_list } from './floorprice_mixin_list'
/** 子组件 */
import tlEdit from './edit'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
export default {
  name: 'mmsProductFloorPriceInfo',
  mixins: [mixin_edit_list],
  components: { tlEdit },
  data() {
    return {
      description: '产品红线价格信息表-列表查询',
      urlPrefix: '/mms/productFloorPriceInfo/',
      url: {
        // queryCodeList: '/mms/productFloorPriceInfo/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'sortcode',
        sord: 'asc'
      },
			floorPricePermission: false
    }
  },
	props: {
			productInfo: {
					type: Object,
					default: function() {
							return {}
					}
			}
	},
  methods: {
      beforeLoadData() {
          this.filtersInfo.qry_productid = this.productInfo.id
          return true
      }
  },
	created() {
			this.floorPricePermission = false
			if (this.$store.getters.roles.includes("BusinessDeptHeader")) {
					this.floorPricePermission = true
			}
	}
}
</script>

<style scoped></style>

